import request from '/@/utils/request';

export function dictApi() {
    return {
        // 分頁獲取數據
        getTableData: (data: object) => {
            return request({
                url: 'dict/type/list',
                method: 'post',
                data
            })
        },
        // 獲取詳情
        getDictInfo: (dictId: number) => {
            return request({
                url: 'dict/type/' + dictId,
                method: 'get',
            })
        },
        addRecord: (dict: object) => {
            return request({
                url: 'dict/type',
                method: 'post',
                data: dict,
            });
        },
        updateRecord: (dict: object) => {
            return request({
                url: 'dict/type',
                method: 'put',
                data: dict,
            });
        },
        delRecord: (dict: object) => {
            return request({
                url: 'dict/type/',
                method: 'delete',
                data: dict
            });
        },
        // 刷新字典缓存
        refreshCache: () => {
            return request({
                url: '/dict/type/refreshCache',
                method: 'delete'
            })
        }
    }
}
